package YAVMM::GuestDB;
use Moose;

with 'MooseX::Object::Pluggable';

has 'settings' => (
    is       => 'rw',
    does     => 'YAVMM::Settings',
    required => 1,
);

sub get_guest          { $_[0]->_not_supported; }
sub delete_guest       { $_[0]->_not_supported; }
sub add_guest          { $_[0]->_not_supported; }
sub set_status         { $_[0]->_not_supported; }
sub update_status      { $_[0]->_not_supported; }
sub get_running_guests { $_[0]->_not_supported; }

sub _not_supported {
    my $self = shift;

    my @caller = caller(1);

    die YAVMM::Error::Guest->new(
        error => "$caller[3] action is not supported by ".$self->_original_class_name
    );
}


our $VERSION = '0.0.1';

__PACKAGE__->meta->make_immutable;
1;

__END__

=head1 NAME

YAVMM::GuestDB - Role for databases which store guest information

=head1 MEMBERS

=head2 settings

B<Type:> YAVMM::Settings

B<Required:> Yes

=head1 METHODS

=head2 YAVMM::Guest $guest|Undef = get_guest(Str $name)

=head2 set_status(YAVMM::Guest $guest|Str $name, Str $status)

=head2 update_guest(YAVMM::Guest $guest|Str $name, YAVMM::Guest $new_guest)

=head2 delete_guest(YAVMM::Guest $guest|Str $name)

=head2 add_guest(YAVMM::Guest $guest)

=head2 [YAVMM::Guest] = get_running_guests(Str $server_hostname ?)

=head2 [???] = get_guest_stats([YAVMM::Guest $guest|Str $name])

Get the running statistics for all given guests.

=head2 set_guest_stats(YAVMM::Guest $guest|Str $name)

